<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	class Teaboy_model extends CI_Model{
		
		public function __contruct(){
			parent::Controller();
		}
		
		public function getCurrentGame(){
			
			//get latest game ID from database
			$sSQL = "SELECT id as currentGame FROM game ORDER BY id DESC LIMIT 0, 1";
			$oResult = $this->db->query($sSQL);
			//get result
			foreach($oResult->result_array() as $row){
				if(!empty($row['currentGame'])){ //we have a current game
					return (int) $row['currentGame'];
				}
				
				return false; //no current game
			}
			
		}
	}